﻿using System;
using System.Collections.Generic;
using System.Text;

namespace openxmlconv
{
    public class Paragraph
    {
        
        Style style = null;
        private  List<Run> run = new List<Run>();

        public List<Run>.Enumerator GetEnumerator()
        {
            return run.GetEnumerator();
        }

        public override bool Equals(object obj)
        {
            if (!(obj is Paragraph))
                return false;
            Paragraph p = (Paragraph)obj;
            for (int i = 0; i < p.GetRuns().Count; i++)
            {
                if (!run[i].Equals(p.GetRuns()[i]))
                    return false;
            }                  
            if (style != p.getStyle())
            {                
                return false;
            }
            else return true;
        }

        public List<Run> GetRuns()
        {
            return run;
        }
        public Style getStyle()
        {
            return style;
        }
        public Paragraph(Run run)
        {
            this.run.Add(run);
        }
        public Paragraph(string text)
        {
            run.Add(new Run(text));
        }
        public Paragraph(string text, Style s)
        {
            run.Add(new Run(text, s));            

        }
        //public string getText()
        //{
        //    return null;
        //}

        internal void add(Run run)
        {
            throw new NotImplementedException();
        }

        internal void SetStyle(Style paragraphStyle)
        {
            style = paragraphStyle;
        }

        internal void Add(Run run)
        {
            this.run.Add(run);
        }
    }
}
